<!DOCTYPE html>
<html lang="en">
<head>
    <title>table表格固定</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-store, must-revalidate">
    <meta http-equiv="expires" content="Wed, 26 Feb 1997 08:21:57 GMT">
    <meta http-equiv="expires" content="-1">
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="refresh" content="1200">
    <link rel="shortcut icon" href="/dist/img/icon.png" type="image/x-icon">
    <!-- Bootstrap 3.3.6 -->
    <link rel="stylesheet" href="https://file.ggxqce.com/web/bootstrap.min.css">
    <!--字体-->
    <link rel="stylesheet" href="/dist/css/font-awesome.min.css">
    <!--图标-->
    <link rel="stylesheet" href="/dist/css/ionicons.min.css">
    <!--OA主样式-->
    <link rel="stylesheet" href="/dist/css/OA.min.css?t=86e2297f">
    <link rel="stylesheet" href="/dist/css/skins/OA-skins.min.css?t=222aea35">
    <link rel="stylesheet" href="/dist/plugins/fixedTable/fixed-table.css"/>
</head>
<style>
    .fixed-table-box th{
        border:none;
        text-align: center;
    }
    .fixed-table-box td{
        text-align: center;
        height:34px;
    }
    .lineOne {
        text-align: left;
    }
    .lineOne span {
        max-height: 20px;
        line-height: 20px;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 1;
        text-align: left;
    }
    .div-td-content-more {
        position: absolute;
        height: auto;
        z-index: 999;
        line-height: 20px;
        background-color: #d3e8fd;
        padding: 8px 6px;
        border: 1px solid #e8e8ea;
        display: none;
    }
    .div-td-content-more i {
        width: 15px;
        height: 12px;
        background: url("/dist/img/more-icon.png");
        position: absolute;
        left: 50px;
        top: -12px;
    }
    .content{
        padding:5px 5px;
    }
</style>
<body>
<section class="content" id="app" v-cloak>
    <div class="div-td-content-more"><i></i></div>
    <div class="fixed-table-box head-fixed">
        <!-- 表头 start -->
        <div class="fixed-table_header-wraper">
            <table class="fixed-table_header" cellspacing="0" cellpadding="0" border="0" style="width: 100%;">
                <thead>
                    <tr>
                        <th style="width: 30px;">序号</th>
                        <th style="width: 70px;">提货日期</th>
                        <th style="width: 75px;">购车公司</th>
                        <th style="width: 52px;">品牌</th>
                        <th style="width: 71px;">型号</th>
                        <th style="width: 134px;">序列号</th>
                        <th style="width: 40px;">斗容</th>
                        <th style="width: 60px;">铲斗类型</th>
                        <th style="width: 70px;">生产日期</th>
                        <th style="width: 50px;">库存地</th>
                        <th style="width: 61px;">库存状态</th>
                        <th style="width: 71px;">预计付款日期</th>
                        <th style="width: 71px;">预计付款金额</th>
                        <th style="width: 50px;">是否结清</th>
                        <th style="width: 63px;">审核状态</th>
                        <th style="width: 12px"></th>
                    </tr>
                </thead>
            </table>
        </div>
        <!--内容-->
        <div class="fixed-table_body-wraper iframeH2" id="divMain">
            <table class="fixed-table_body" cellspacing="0" cellpadding="0" border="0" style="width: 100%;">
                <tbody>
                    <tr v-for="(item,i) in list">
                        <td style="width: 30px;">{{i+1}}</td>
                        <td style="width: 70px;">{{item.pickUpDate.substring(2)}}</td>
                        <td style="width: 75px;">{{item.companyName}}</td>
                        <td style="width: 52px;">{{item.brandName}}</td>
                        <td style="width: 71px;">{{item.modelName}}</td>
                        <td style="width: 134px;">{{item.sequence}}</td>
                        <td style="width: 40px;">{{item.bucketCapacity}}</td>
                        <td style="width: 60px;" class="lineOne"><span >{{item.bucketType}}</span></td>
                        <td style="width: 70px;">{{item.productionDate.substring(2)}}</td>
                        <td v-html="showDz(item)" style="width: 50px;"></td>
                        <td v-html="convertAuditFlagToName(item)" style="width: 61px;"></td>
                        <td style="width: 71px;">{{item.expirationDate.substring(2)}}</td>
                        <td style="width: 71px;">{{fmoney(item.expirationMoney)}}</td>
                        <td style="width: 50px;">{{item.settle}}</td>
                        <!--审核状态-->
                        <td v-if="item.auditFlag=='-1'" style="width: 63px;">-</td>
                        <td v-else-if="item.auditFlag=='0'" style="width: 63px;">
                            <span style="color: red;">待-{{item.auditName}}-审核</span>
                        </td>
                        <td v-else-if="item.auditFlag=='1'" style="width: 63px;">已通过</td>
                        <td v-else-if="item.auditFlag=='2'" style="width: 63px;">已驳回</td>
                        <td v-else style="width: 63px;">-</td>
                        <template v-if="list.length>=heightNum">
                            <td style="width: 0px;border-left: 0px;"></td>
                        </template>
                        <template v-else>
                            <td style="width: 17px;border-left: 0px;"></td>
                        </template>
                    </tr>
                </tbody>
            </table>
        </div>
    </div>
</section>
<!--JQ-->
<script src="https://file.ggxqce.com/web/jquery-2.2.3.min.js"></script>
<!--插件JS-->
<script src="https://file.ggxqce.com/web/bootstrap.min.js"></script>
<!--框架已定义 JS-->
<script src="/dist/js/app_iframe.js?t=7e54a132"></script>
<!--oa自定义  JS-->
<script src="/dist/js/oa.js?t=558d0414"></script>
<script src="https://file.ggxqce.com/web/vue.min.js"></script>
<script type="text/javascript" src="/dist/plugins/lhgdialog/lhgdialog.min.js?self=true"></script>
<script src="/dist/plugins/fixedTable/fixed-table.js"></script>
<script>
    $(function () {
        $("body").on("click", ".lineOne", function (e) {
            if ($(".div-td-content-more").is(":hidden")) {
                var text = $(this).text();
                if (text != "") {
                    text = "<i></i>" + text;
                    $(".div-td-content-more").html(text).css({
                        "width": $(this).outerWidth() + "px",
                        "left": $(this).offset().left,
                        "top": ($(this).offset().top + $(this).outerHeight()) + "px"
                    }).show();
                    e.stopPropagation();
                }
            } else {
                $(".div-td-content-more").hide();
            }
        });
        $("body").on("click", ".div-td-content-more", function (e) {
            e.stopPropagation();
        });
        $("body").on("click", function () {
            $(".div-td-content-more").hide();
        });
    });
</script>
<script type="text/javascript">
    var app = new Vue({
        el:"#app",
        data:{
            currentUser: getCurrentUser(),
            list: [],
            heightNum:0
        },
        methods:{
            //获取列表数据
            getList:function () {
                var that = this;
                $.wyui.postMethod('/deviceSample/getDeviceSampleList.json', {
                    userId: getCurrentUser().id
                }, function (r) {
                    that.list = r.records;
                    that.getHeight();
                })
            },
            //库存地
            showDz: function (item) {
                var html = item.storeAddress;
                if (html == "直发客户交机") {
                    return html;
                } else {
                    var sta = html.indexOf("省");
                    var pos = html.indexOf("市");
                    return html.substring(sta + 1, pos + 1);
                }
            },
            /*判断状态为已出库或草稿时显示红色*/
            convertAuditFlagToName: function (item) {
                switch (item.state) {
                    case "已交":
                        return "<span style='color:red;'>" + item.state + "</span>";
                        break;
                    case "库存":
                        return "<span style='color:white;background-color:#8c8c8c'>" + item.state + "</span>";
                        break;
                    default :
                        return "<span>" + item.state + "</span>";
                        break;
                }
            },
            //获取内容高度
            getHeight:function(){
                var that = this;
                var allHeight = $("#divMain").height();
                that.heightNum = allHeight/34;
            },
            //金额
            fmoney: function (s, n) {
                n = n > 0 && n <= 20 ? n : 2;
                s = parseFloat((s + "").replace(/[^\d\.-]/g, "")).toFixed(n) + "";
                var l = s.split(".")[0].split("").reverse(), r = s.split(".")[1],
                    t = "";
                for (i = 0; i < l.length; i++) {
                    t += l[i] + ((i + 1) % 3 == 0 && (i + 1) != l.length ? "," : "");
                }
                return t.split("").reverse().join("") + "." + r;
            },
        },
        mounted:function () {
            var that = this;
            that.getList();
        }
    })
</script>
<script>
    //初始化FixedTable
    $(".fixed-table-box").fixedTable();
</script>
</body>
</html>